<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>报价解密查看</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %> 
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content" style="margin-top:20px">
     <div style="width:500px;height:400px;float:left;margin-left:22px;">
        <table class="jqgrid" id="gridlist1" ></table>
    </div> 
     <div style="width:500px;height:400px;float:right;margin-right:22px;">   
        <table class="jqgrid" id="gridlist2"></table>
	</div>  
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp" %> 
    <script type="text/javascript">
    
        
        $(function () {
            $("#gridlist1").jqGrid({
                url: "${ctx}/bidScoreRule/getDecryptCompList.html",
                mtype: "POST",
                datatype: "json",
                postData:{"projId":"${projId}"},
               width: 500,
                height: 360,
                colNames: [  '','','','','企业名称', '解密药品数'],
                colModel: [
					{ name: 'compId', width: 160 , align:"center" ,sortable: false,hidden:true},
					{ name: 'compCount', width: 160 , align:"center" ,sortable: false,hidden:true},
					{ name: 'drugDecryptCount', width: 160 , align:"center" ,sortable: false,hidden:true},
					{ name: 'drugCount', width: 160 , align:"center" ,sortable: false,hidden:true},
                    { name: 'compName', width: 160 , align:"center" ,sortable: false},
                    { name: 'count', width: 100 , align:"center" ,sortable: false,
                    	formatter:function(val,opts,rowdata){
                    		var str = rowdata.drugDecryptCount+"/"+rowdata.drugCount;
                    		return  str;
                    	}	
                    },
                ],
                rowNum: 100,
                rownumbers: true,
                caption: "解密企业",
                jsonReader: {
                    repeatitems: false,
                },
                gridComplete:function(){
                	var rowdata = $("#gridlist1").jqGrid('getRowData',1);
                	var rowListNum = jQuery("#gridlist1").jqGrid('getGridParam', 'records'); 
                	if(rowdata.compName){
                		var str = "开启解密企业数    "+rowListNum+"/"+rowdata.compCount;
                    	$("#gridlist1").setCaption(str);
                	}
                }
            });
            $("#gridlist1").jqGrid('navGrid', '#gridpage1', { add: false, edit: false, del: false, search: false, refresh: false });
            
            $("#gridlist2").jqGrid({
                url: "${ctx}/bidScoreRule/getDecryptDrugList.html",
                mtype: "POST",
                datatype: "json",
                postData:{"projId":"${projId}"},
               width: 500,
                height: 360,
                colNames: [  '','','通用名', '剂型','规格'],
                colModel: [
					{ name: 'drugDecryptCount', width: 160 , align:"center" ,sortable: false,hidden:true},
					{ name: 'drugCount', width: 160 , align:"center" ,sortable: false,hidden:true},
                    { name: 'drugName', width: 160 , align:"center" ,sortable: false},
                    { name: 'form', width: 100 , align:"center" ,sortable: false},
                    { name: 'spec', width: 100 , align:"center" ,sortable: false},
                ],
                rowNum: 0,
                rownumbers: true,
                caption: "解密药品",
                jsonReader: {
                    repeatitems: false,
                },
                gridComplete:function(){
                	var rowdata = $("#gridlist2").jqGrid('getRowData',1);
                	if(rowdata.drugName){
                		var str = "药品解密数    "+rowdata.drugDecryptCount+"/"+rowdata.drugCount;
                    	$("#gridlist2").setCaption(str);
                	}
                }
            });
            $("#gridlist2").jqGrid('navGrid', '#gridpage2', { add: false, edit: false, del: false, search: false, refresh: false });
        });
        
        function reload(){
        	var page = jQuery("#gridlist1").jqGrid('getGridParam', 'page'); 
        	var rowListNum = jQuery("#gridlist1").jqGrid('getGridParam', 'records'); 
        	var maxPage = 0;
        	if(rowListNum%100==0){
        		maxPage = rowListNum/100;
        	}else{
        		maxPage = rowListNum/100+1;
        	}
        	page = page+1;
        	if(page>maxPage){
        		page=1;
        	}
        	 $("#gridlist1").jqGrid('setGridParam',{  
        		page:page
		    }).trigger("reloadGrid"); //重新载入  
		    
		    $("#gridlist2").jqGrid().trigger("reloadGrid"); //重新载入   
        }
	   
        setInterval(reload,10000);
    </script>
</body>
</html>